package BehavioralModel.ObserverModel;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 王蕾 [wanglei_dev@cyou-inc.com]
 * @date 2017-11-28 11:57:00
 */
public class SecretarySubject implements  Subject {

    private List<Observer> observerList = new ArrayList<Observer>();

    private String action;

    @Override
    public void addObserver(Observer observer) {
        observerList.add(observer);
    }

    @Override
    public void removeObserver(Observer observer) {
        observerList.remove(observer);
    }

    @Override
    public void inform() {
        observerList.stream().forEach(Observer::update);
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }
}

